import 'package:get/get.dart';

import '../../../dd_core/dd_log_service.dart';
import '../../../r.dart';

class MainTabModel {
  String title;
  String iconName;
  String selectedIconName;

  MainTabModel({
    required this.title,
    required this.iconName,
    required this.selectedIconName,
  });
}

class DDMainTabController extends GetxController {
  var tabIndex = 0.obs;

  List<MainTabModel> tabList = <MainTabModel>[];

  final showMatching = false.obs;


  @override
  void onInit() {
    tabList = [
      MainTabModel(
        title: '',
        iconName: R.assetsImagesTbN1,
        selectedIconName: R.assetsImagesTbS1,
      ),
      MainTabModel(
        title: '',
        iconName: R.assetsImagesTbN2,
        selectedIconName: R.assetsImagesTbS2,
      ),
      MainTabModel(
        title: '',
        iconName: R.assetsImagesTbN3,
        selectedIconName: R.assetsImagesTbS3,
      ),
      MainTabModel(
        title: '',
        iconName: R.assetsImagesTbN4,
        selectedIconName: R.assetsImagesTbS4,
      ),
    ];
    DDLogService().ddGa(page: "tabbar_${0}");
    super.onInit();
  }

  void tabIndexChange(int index) {
    if (tabIndex.value != index) {
      tabIndex.value = index;
      DDLogService().ddGa(page: "tabbar_${index}");
    }
  }

  @override
  void onClose() {
    showMatching.close();
    super.onClose();
  }
}